var btns = document.getElementsByTagName('li');
var cons = document.getElementsByClassName('con');

for(var i = 0; i < btns.length; i++) {
	btns[i].index = i; //给每个按钮自定义了一个index属性---index就是索引
	btns[i].onclick = function () {
		for (var j = 0; j < btns.length; j++) {
			btns[j].className = ""
		}
		this.className="active"
		
		for(var k = 0; k < cons.length; k++){
			cons[k].style.display="none"
		}
		cons[this.index].style.display="block"
	}
}